package com.example.octopus.service;

import com.example.octopus.entity.Comment;
import com.example.octopus.entity.Product;
import com.example.octopus.entity.returnMessage.DeleteReturnMessage;
import com.example.octopus.entity.returnMessage.InsertReturnMessage;
import com.example.octopus.entity.returnMessage.SelectReturnMessage;
import com.example.octopus.entity.returnMessage.UpdateReturnMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class CommentServiceImpl implements CommentService{
    private DataBaseService dataBaseService;
    //等待yml注入
    private final String collection="comment";
    @Autowired
    public CommentServiceImpl(DataBaseService dataBaseService){
        this.dataBaseService=dataBaseService;
    }

    @Override
    public InsertReturnMessage insert(String env, List<Comment> comments) {
        return dataBaseService.insert(collection,env,comments);
    }
    @Override
    public DeleteReturnMessage delete(String env, Map<String, Object> condition) {
        return dataBaseService.delete(collection,env,condition);
    }
    @Override
    public SelectReturnMessage select(String env, Map<String, Object> condition,int page) {
        return dataBaseService.select(collection,env,condition,page);
    }
    @Override
    public UpdateReturnMessage update(String env, String docId, Comment comment) {
        return dataBaseService.update(collection,env,docId,comment);
    }
}
